package com.qfedu.edu.queuemonitorservice.config;

import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
import com.qfedu.edu.queuemonitorservice.properties.ElasticJobProperties;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * @author xiaobobo
 * @title: ZookeeperConfig
 * @projectName cd-java-fy-2401-springboot-parent
 * @description: 这个配置的是 Zookeeper的配置文件
 * @date 2024/10/31  9:35
 */
@SpringBootConfiguration
@EnableConfigurationProperties(ElasticJobProperties.class)
public class ZookeeperConfig {

    /**
     * 主要配置的是注册中心
     * @return
     */
    @Bean(initMethod = "init")
    public ZookeeperRegistryCenter zookeeperRegistryCenter(ElasticJobProperties elasticJobProperties) {
        ZookeeperRegistryCenter zookeeperRegistryCenter1 = new ZookeeperRegistryCenter(new ZookeeperConfiguration(elasticJobProperties.getZookeeperRegistryCenterHost(), elasticJobProperties.getZookeeperRegistryCenterNameSpace()));
        return zookeeperRegistryCenter1;
    }


}
